import numpy as np
from scipy.integrate import quad

# 定义被积函数
def f(x):
    return 1 - 2 * np.sin(x)

# 计算定积分
result, error = quad(f, 0, np.pi / 2)
print("定积分结果:", result)